<?php 
require_once '../Model/DBconnect.php';
if(isset($_GET['player'])){

	echo "<table id='ismElementDataTable' class='ismTable ismPlayerList' style='display:table; border='1'>
		<tr>
			<th>Pos</th>
			<th>
				<a class='ismPositionLink'>Player</a>
			</th>
			<th>Team</th>
			<th>$</th>
			<th>
				<abbr title='Total score'>Score</abbr>
			</th>
		</tr>";

	$dbconnect = DBconnect::getInstance();
	$query = $dbconnect->getInfoForPlayer($_GET['player']);
	while($players = mysql_fetch_assoc($query)){
		$player_name = $players['player_name'];
		$team_short_name = $players['short_name'];
		$value = $players['value'];
		$total_score = $players['total_score'];
		$player_no = $players['player_no'];
		settype($player_no, "int");
		$position_name = $players["pos_name"];
		$short_pos_name = strtoupper(substr($position_name, 0, 3));
		$setFunctionName = "set".$position_name."(".$player_no.", ".$value.")";
		echo "<tr onclick='$setFunctionName' style='cursor:pointer;'><td>$short_pos_name</td><td>$player_name</td><td>$team_short_name</td><td>$value</td><td>$total_score</td></tr>";
	}
}
?>